package com.yoyosys.echo.manager.cluster.service.impl;

import com.yoyosys.echo.manager.system.common.Message;
import com.yoyosys.echo.manager.cluster.dao.ApiLimitMapper;
import com.yoyosys.echo.manager.cluster.po.ApiLimit;
import com.yoyosys.echo.manager.cluster.service.ApiLimitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ApiLimitServiceImpl implements ApiLimitService {
    @Autowired
    private ApiLimitMapper apiLimitMapper;
    @Override
    public Message apiapply(ApiLimit apiLimit) {
        Message message = new Message();
        try {
            apiLimitMapper.apiapply(apiLimit);
            message.setSuccessMsg("API申请信息提交成功");
            message.setData(apiLimit.getRequestId());
            message.setCode("200");
        }catch (Exception e){
            message.setErrorMsg("API申请信息提交失败");
            message.setCode("500");
            message.setData(e.getMessage());
        }
        return message;
    }
}
